package com.weng.platform.guest.api;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.weng.framework.core.model.ResponseData;
import com.weng.framework.web.base.BaseController;
import com.weng.platform.guest.entity.GuestVisitLog;
import com.weng.platform.guest.service.IGuestVisitLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 访客记录 API实现
 * @author weng
 * @date 2021-03-12 14:45:32
 *
 */  
@Slf4j
@RestController
@RequestMapping("/guest-visit-logs")
@Api(value = "访客记录api", tags = {"访客记录操作接口"})
public class GuestVisitLogApi extends BaseController {
    @Autowired
    private IGuestVisitLogService guestVisitLogService;

    /**
     * 功能描述:单个获取访客记录
     */
    @ApiOperation(value = "获取访客记录", notes = "")
    @GetMapping(value = "/{id}")
    public ResponseData get(@PathVariable("id") String id){
        GuestVisitLog guestVisitLog = guestVisitLogService.getById(id);
        return success(guestVisitLog);
    }


    /**
     * 条件 分页查询访客记录
     */
    @ApiOperation(value = "分页获取访客记录", notes = "")
    @GetMapping(value = "")
    public ResponseData list(Integer pageNo,Integer pageSize, String resourceId){
		IPage<GuestVisitLog> iPage = guestVisitLogService.list(pageNo, pageSize, resourceId);
        return success(iPage);
    }



}
